﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Csla.Xaml;
using HeThongThongTin.Library;

namespace HeThongThongTin.UI.SL.HeThong.HT_QuanLyVaiTroQuyenHan
{
    public class HT_VaiTro_QuyenHan_ViewModel : ViewModel<HeThongThongTin.Library.HT_VaiTro_QuyenHan>
    {
        public event EventHandler Saved;
        public event EventHandler Canceled;
        public event EventHandler LoadCompleted;
     
        public HT_VaiTro_QuyenHan_ViewModel()
        {
            
                this.BeginRefresh("NewHT_VaiTro_QuyenHan"); 
        }

        public HT_VaiTro_QuyenHan_ViewModel(int KhoaNguoiDung)
        {

            this.BeginRefresh("NewHT_VaiTro_QuyenHan");
        }

        protected override void OnRefreshed()
        {
            base.OnRefreshed();
            if (Model != null)
            {
                if (LoadCompleted != null)
                {
                    LoadCompleted(this, new EventArgs());
                }
            }
        }
        public HT_VaiTro_QuyenHan_ViewModel(string mode, string TenDangNhap)
        {
            if( mode.Equals(BusinessConfiguration.Configuration.QuanLyTaiKhoanMode))
            {
                this.BeginRefresh("GetHT_VaiTro_QuyenHan", TenDangNhap);  
            }
                  
        }

        public void GetHT_VaiTro_QuyenHan(object sender, ExecuteEventArgs e)
        {            
            if (e.MethodParameter != null)
            {
                //cast parameter
                string parameter = e.MethodParameter.ToString();
                this.BeginRefresh("GetHT_VaiTro_QuyenHan", int.Parse(parameter));
            }
        }

       

        public void NewHT_VaiTro_QuyenHan()
        {
            this.BeginRefresh("NewHT_VaiTro_QuyenHan");
            
        }

        protected override void OnSaved()
        {
            base.OnSaved();
            if (Saved != null)
            {
                Saved(this, EventArgs.Empty);
            }
        }

        protected override void DoCancel()
        {
            base.DoCancel();
            if (Canceled != null)
            {
                Canceled(this, EventArgs.Empty);
            }
        }
    }
}

        
  
        
        
				
        
				
        